package com.jianan.mis.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegularUtils {

    /**
	 * 验证输入的邮箱格式是否符合
	 * 
	 * @param email
	 * @return 是否合法
	 */
	public static boolean emailCheck(String email) {
		boolean result = true;
		final String patternStr = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
		final Pattern pattern = Pattern.compile(patternStr);
		final Matcher matcher = pattern.matcher(email);
		if (!matcher.find()) {
			result = false;
		}
		return result;
	}
}
